package com.tdengine.test;

import com.taosdata.jdbc.TSDBDriver;
import org.jtransforms.fft.DoubleFFT_1D;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Properties;

public class FFT {



    public static void main(String[] args) throws Exception {
        Connection conn = getRestConn();
        Statement stmt = conn.createStatement();

// create database
        stmt.executeUpdate("create database if not exists db");

// use database
        stmt.executeUpdate("use db");

// create table
        stmt.executeUpdate("create table if not exists tb (ts timestamp, temperature int, humidity float)");
    }

    public static Connection getRestConn() throws Exception{
        Class.forName("com.taosdata.jdbc.rs.RestfulDriver");
        String jdbcUrl = "jdbc:TAOS-RS://180.101.145.165:32485/testdb?user=root&password=taosdata";
        Properties connProps = new Properties();
        connProps.setProperty(TSDBDriver.PROPERTY_KEY_BATCH_LOAD, "true");
        Connection conn = DriverManager.getConnection(jdbcUrl, connProps);
        return conn;
    }
}
